home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / trinitybbs20.lha / OLP / tradewars.lzh / twmain < prev    next >
Text File  |  1992-05-23  |  44KB  |  2,303 lines

  1. /* Tradewars Amiga mainfile
  2.      By Jim Holzknecht                   */
  3. options results
  4. omem=storage()
  5. getuser 1
  6. name=result
  7. getuser 27
  8. linelength=result
  9. getuser 41
  10. serialn=result
  11. getuser 17
  12. maint=result
  13. PF='olp:TRADEWARS/'
  14. PFP='olp:TRADEWARS/players/'
  15. PFU='olp:TRADEWARS/universe/'
  16. PFT='olp:TRADEWARS/teams/'
  17. PFW='olp:TRADEWARS/planets/'
  18. date=date('U')
  19. sector=0
  20. turns=0
  21. signal on error
  22. signal on syntax
  23. signal on ioerr
  24. filen=PF'autodata.tw'
  25. call open file, (filen), 'R'
  26. do x=1 to 7
  27. am.x=readln(file)
  28. end
  29. call close file
  30. filen=PF'unidata.tw'
  31. call open file, (filen), 'R'
  32. ns=readln(file)
  33. cbs=readln(file)
  34. call close file
  35. filen=PF'var.tw'
  36. call open file, (filen), 'R'
  37. c.1=readln(file)
  38. c.2=readln(file)
  39. call close file
  40. if exists(PF'errlog') then do
  41. logentry '\z7\c0Tradewars ran under error conditions. Check errlog.\z0\q1'
  42. end
  43. transmit '\n2\c6Tradewars Version \c21.05d (*Release*)'
  44. transmit '\n1\c6Initializing\c1...'
  45. ur=0
  46. x=0
  47. yoop:
  48. x=x+1
  49. if x >40 then signal yoopa
  50. user=PFP'p' x
  51. call open file, (user), 'R'
  52. do y=1 to 15
  53. pl.x.y=readln(file)
  54. end
  55. call close file
  56. signal yoop 
  57. yoopa:
  58. x=0
  59. usersearch:
  60. x=x+1
  61. if x=41 then do
  62. ur=0
  63. signal usersearcha
  64. end
  65. if pl.x.15=serialn then do
  66. ur=x
  67. if pl.x.1 ~= name then do
  68. transmit '\c7\n1Name change noted...'
  69. pl.x.1=name
  70. end
  71. signal usersearcha
  72. end
  73. signal usersearch
  74.  
  75. usersearcha:
  76. if ur=0 then signal twnew
  77. if pl.ur.4=0 & pl.ur.14=date('c') then do
  78. transmit '\n1\c2You just died today. You will get a new ship tomorrow.'
  79. signal end
  80. end
  81. if pl.ur.4=0 then signal twnew
  82.  
  83. twstart:
  84. if ur=0 then signal end
  85. pl.ur.15=serialn
  86. transmit '\n1\c7*** \c5'ns' sectors!  GOOD LUCK! \c7***'
  87. transmit '\n1\c1Welcome 'name'!!!'
  88. transmit '\n1\c4The following happened to your ship since your last time on:\c3'
  89. number=ur
  90. if exists(PF''number) then do
  91. sendfile PF''number
  92. address command 'delete 'PF''number
  93. signal twstarta
  94. end
  95. transmit 'Nothing...'
  96. twstarta:
  97. a=pl.ur.1' ['pl.ur.2'] Logged on: 'date' / 'time()
  98. call newspaperopen
  99.  
  100.  
  101. twstartc:
  102. if pl.ur.6=date then transmit '\n1\c2You have been on today.'
  103. turns=pl.ur.5
  104. if pl.ur.6 ~= date then turns=am.7
  105. transmit '\n1\c6You have \c1'turns' \c6turns remaining.'
  106. if turns=0 then do
  107. transmit '\n1\c2Sorry, you have no turns!'
  108. signal end
  109. end
  110. call twlotto 
  111. hom:
  112. transmit '\n1\c7Checking for messages sent to you\c1...\c3'
  113. x=0
  114. filen=PF'1ALL.msg';call mesr
  115. filen=PF'2ALL.msg';call mesr
  116. filen=PF'3ALL.msg';call mesr
  117. filen=PF''ur'.msg';x=1;call mesr
  118. signal hom2
  119.  
  120. mesr:
  121. if exists(filen) then do
  122. sendfile filen
  123. if x=1 then do
  124. address command 'delete 'filen
  125. end
  126. end
  127. return
  128.  
  129. hom2:
  130. sector=pl.ur.4
  131. call ds
  132. signal mainmenu
  133.  
  134. end0:
  135. sendstring '\n1\c5Are you sure [\c1Y\c5/\c1n\c5]? \c3'
  136. call ask
  137. if an='N' then signal mainmenu
  138. transmit '\n1\c6Saving\c1...'
  139. end2:
  140. user=PFP'p' ur
  141. pl.ur.4=sector
  142. pl.ur.5=turns
  143. pl.ur.6=date('U')
  144. pl.ur.14=date('C')
  145. pl.ur.15=serialn
  146. call open file, (user), 'W'
  147. do x=1 to 15
  148. call writeln file, pl.ur.x
  149. end
  150. call close file
  151. end:
  152. exit
  153.  
  154. twnew:
  155. transmit '\n1\c5Building A Ship For You\c1...'
  156. if ur>0 then signal parta
  157. ur=0
  158. x=0
  159. checklist:
  160. x=x+1
  161. if x>41 then do
  162. ur=0
  163. signal build
  164. end
  165. if left(pl.x.1,1)="." then do
  166. ur=x
  167. signal build
  168. end
  169. signal checklist
  170. build:
  171. if ur=0 then do
  172. transmit '\n1\c2There is no room for the likes of you.'
  173. transmit '(try again later)'
  174. signal twstart
  175. end
  176. pl.ur.1=name
  177. pl.ur.2='0'
  178. pl.ur.6='0'
  179. pl.ur.13='0'
  180. parta:
  181. pl.ur.3='200'
  182. pl.ur.4='1'
  183. pl.ur.5=am.7
  184. pl.ur.7='20'
  185. pl.ur.8='0'
  186. pl.ur.9='0'
  187. pl.ur.10='0'
  188. pl.ur.11='0'
  189. pl.ur.12='1000'
  190. signal twstart
  191. key:
  192. bufferflush
  193. sendstring '\c6(\c1-*Press Any Key*-\c6)\c3'
  194. getchar
  195. transmit '\h9\h7\h7'
  196. return
  197.  
  198. error:
  199. a=SIGL
  200. transmit '\n1Error in Line #'a
  201. an='-- Error; Line #'a'\n1   'pl.ur.1
  202. signal errorlog
  203. syntax:
  204. a=SIGL
  205. transmit '\n1Syntax Error In Line #'a
  206. an=sourceline(a)
  207. transmit 'Line Reads : >'an'<'
  208. an='-- Syntax Error; Line #'a'\n1   >'sourceline(a)'<\n1   'pl.ur.1||' 'sector
  209. signal errorlog
  210. errorlog:
  211. if ~exists(PF'errlog') then do
  212. call open file, (PF'errlog'), 'W'
  213. call writeln file, an
  214. call close file
  215. bbscommand 'F'
  216. signal end
  217. end
  218. call open file, (PF'errlog'), 'A'
  219. call writeln file, an
  220. call close file
  221. bbscommand 'F'
  222. signal end
  223. ioerr:
  224. a=SIGL
  225. transmit '\n1I/O Error In Line #'a
  226. an='-- I/O Error; Line #'a'\n1   'pl.ur.1
  227. signal errorlog
  228. newspaperopen:
  229. if exists(PF'paper.tw') then do
  230. call close file
  231. call open file, (PF'paper.tw'), 'A'
  232. call writeln file, a
  233. call close file
  234. drop a
  235. return
  236. end
  237. call close file
  238. call open file, (PF'paper.tw'), 'W'
  239. call writeln file, a
  240. call close file
  241. drop a
  242. return
  243.  
  244. sectordata:
  245. uni=PFU'tws'sector
  246. call close file
  247. call open file, (uni), 'R'
  248. do i=1 to 26
  249. sd.i=readln(file)
  250. end
  251. call close file
  252. sdt.1=trim(sd.1)
  253. upper sdt.1
  254. if left(sd.1,1)='.' then sdt.1='None'
  255. if sdt.1='None' then sdt.2=''
  256. if sdt.1 ~= 'None' then do
  257. sdt.2=', class 'sd.2
  258. sdt.1=sdt.1''sdt.2
  259. end
  260. sdt.3=sd.3
  261. if sd.3=0 then sdt.3=''
  262. sdt.4=sd.4
  263. if sd.4=0 then sdt.4=''
  264. sdt.5=sd.5
  265. if sd.5=0 then sdt.5=''
  266. sdt.6=sd.6
  267. if sd.6=0 then sdt.6=''
  268. sdt.21=sd.21
  269. if sd.21=0 then sdt.21=''
  270. sdt.22=sd.22
  271. if sd.22=0 then sdt.22=''
  272. return
  273.  
  274. ds:
  275. call sectordata
  276. transmit   '\n1\c2Sector  : 'sector
  277. transmit   '\c4Port    : 'sdt.1
  278. if left(sd.26,2) ~= '..' & sd.26 ~= '' then transmit   '\c7Planet  : 'sd.26
  279. sendstring '\c3Ships   : '
  280. nf=0
  281. do x=1 to 40
  282. if pl.x.4=sector then do
  283. if x ~= ur then do
  284. nf=1
  285. sendstring '\n1   'pl.x.1
  286. if pl.x.2>0 then do
  287. sendstring ' Team ['pl.x.2']'
  288. end
  289. sendstring ' with 'pl.x.3' fighters'
  290. end 
  291. end
  292. end 
  293. if nf=0 then sendstring 'None'
  294. sendstring '\n1\c5Fighters: '
  295. if sd.8>0 then do
  296. sendstring sd.8' belonging to '
  297. y=sd.9
  298. if sd.9=99 then sendstring 'the Cabal'
  299. if sd.9 ~= 99 then sendstring pl.y.1
  300. if pl.y.2>0 then do
  301. if sd.9 ~= 99 then sendstring ' ['pl.y.2']'
  302. end
  303. transmit ''
  304. end
  305. if sd.8=0 then transmit 'None'
  306. sendstring '\c7Warps   : 'sdt.3
  307. if sdt.4 ~= '' then sendstring ', 'sdt.4
  308. if sdt.5 ~= '' then sendstring ', 'sdt.5
  309. if sdt.6 ~= '' then sendstring ', 'sdt.6
  310. if sdt.21 ~= '' then sendstring ', 'sdt.21
  311. if sdt.22 ~= '' then sendstring ', 'sdt.22
  312. if sd.16>0 then do
  313. sendstring '\n1\c1<\c2Mine In This Sector\c1>'
  314. end
  315. transmit '\n1'
  316. return
  317.  
  318. mainmenu:
  319.  
  320. sendstring '\c4Main Command (A,B,C,D,F,G,I,L,M,P,Q,S,T,Z,?)? \c1'
  321. call ask
  322. if an='Q' then signal end0
  323. if an='A' then signal attack
  324. if an='B' then signal bank
  325. if an='C' then signal computer
  326. if an='D' then do
  327. call ds
  328. signal mainmenu
  329. end
  330. if an='F' then signal fighters
  331. if an='G' then signal gamble
  332. if an='I' then signal information
  333. if an='L' then signal land 
  334. if an='M' then do
  335. if turns=0 then do
  336. transmit '\n1\c2Sorry, you have no more turns left!'
  337. signal mainmenu
  338. end
  339. signal move
  340. end
  341. if an='P' then do
  342. if turns=0 then do
  343. transmit '\n1\c2Sorry, you have no more turns left!'
  344. signal mainmenu
  345. end
  346. signal port
  347. end
  348. if an='#' then signal mi
  349. if an='S' then signal mine
  350. if an='T' then signal team
  351. if an='Z' then do
  352. sendfile PF'tw.help'
  353. signal mainmenu
  354. end
  355. if an="?" then do
  356. sendfile PF'main.help'
  357. signal mainmenu
  358. end
  359. signal mainmenu
  360.  
  361. mi:
  362. transmit '\f1Bytes free when Tradewars was begun were' omem
  363. an=storage()
  364. transmit 'There are' an ' bytes available now.'
  365. an=omem-an
  366. transmit 'Tradewars is using' an ' bytes.'
  367. signal mainmenu
  368.  
  369. twlotto:
  370. if pl.ur.6=date then return
  371. transmit '\n1\c5Do you wish to play the intergalactic pick 4 lottery?'
  372. aks='\c4A ticket costs 10 credits (\c7Y\c4/\c7n\c4)? \c1'
  373. call askq
  374. upper an
  375. if an='N' then return
  376. if pl.ur.12<10 then do
  377. transmit '\n1\c2You do not have enough money!'
  378. return
  379. end
  380. pl.ur.12=pl.ur.12-10
  381. getlotnum:
  382. aks='\n1\c2What is your four digit number for the lottery computer? \c1'
  383. call askq
  384. len=length(an)
  385. if len <4 then signal getlotnum
  386. an=left(an,4)
  387. transmit '\n1\c6Working\c1...'
  388. rn=random(1,9,time('s'))
  389. a=rn
  390. rn=random(1,9,time('s'))
  391. bo=rn
  392. rn=random(1,9,time('s'))
  393. c=rn
  394. rn=random(1,9,time('s'))
  395. d=rn
  396. transmit '\n1\c5The Galactic Lottery Computer picked \c7'a''bo''c''d'\c5.'
  397. x=0
  398. z=0
  399. fruitloop:
  400. z=z+1
  401. if z=5 then signal check
  402. y=substr(an,z,1)
  403. if y=a then do
  404. x=x+1
  405. a=99
  406. signal fruitloop
  407. end
  408. if y=bo then do
  409. x=x+1
  410. b=99
  411. signal fruitloop
  412. end
  413. if y=c then do
  414. x=x+1
  415. c=99
  416. signal fruitloop
  417. end
  418. if y=d then do
  419. x=x+1
  420. d=99
  421. signal fruitloop
  422. end
  423. signal fruitloop
  424. check:
  425. transmit '\n1\c1You matched\c2' x '\c1digits.'
  426. if x=0 then y=0
  427. if x=1 then y=50
  428. if x=2 then y=5000
  429. if x=3 then y=15000
  430. if x=4 then y=50000
  431. pl.ur.12=pl.ur.12+y
  432. transmit '\n1\c3You won \c1'y' \c3credits giving you a total of \c1'pl.ur.12' \c3credits!'
  433. if y>50 then do
  434. a=pl.ur.1' won 'y' credits in the lottery.'
  435. call newspaperopen
  436. end
  437. drop a bo c d x y rn
  438. signal hom
  439.  
  440. ws:
  441. call open file, (PFU'tws'sector), "W"
  442. do yop=1 to 26
  443. call writeln file, sd.yop
  444. end
  445. call close file
  446. drop yop
  447. return
  448.  
  449. saveuser:
  450. call open file, (PFP'p' x), 'W'
  451. do yup=1 to 15
  452. call writeln file, pl.x.yup
  453. end
  454. call close file
  455. drop yup
  456. return
  457.  
  458. hapopen:
  459. number=x
  460. filename=PF''number
  461. if exists(filename) then do
  462. call open file, (filename), 'A'
  463. call writeln file, hap
  464. call close file
  465. return
  466. end
  467. call open file, ('olp:TRADEWARS/'number), 'W'
  468. call writeln file, hap
  469. call close file
  470. drop hap
  471. return
  472.  
  473. move:
  474. transmit ''
  475. if ape=1 then signal moveit
  476. sendstring '\c1Warps lead to 'sdt.3
  477. if sdt.4 ~= '' then sendstring ', 'sdt.4
  478. if sdt.5 ~= '' then sendstring ', 'sdt.5
  479. if sdt.6 ~= '' then sendstring ', 'sdt.6
  480. if sdt.21 ~= '' then sendstring ', 'sdt.21
  481. if sdt.22 ~= '' then sendstring ', 'sdt.22
  482. aks = '\n1\c3Move To? \c7'
  483. call askq
  484. an=strip(an)
  485. if left(an,1)='0' then signal mainmenu
  486. if an='' then signal mainmenu
  487. if an=0 then an=1000000
  488. if cs=1 then do
  489. call ws
  490. cs=0
  491. end
  492. moveit:
  493. if an=sdt.3 | an=sdt.4 | an=sdt.5 | an=sdt.6 | an=sdt.21 | an=sdt.22 then do
  494. ls=sector
  495. sector=an
  496. turns=turns-1
  497. call ds
  498. if sd.8>0 then do
  499. call fightercheck
  500. if x=1 then signal attackf
  501. end
  502. if sd.16>0 then do
  503. call minecheck
  504. if x=1 then signal mineexp
  505. end
  506. signal mainmenu
  507. end
  508. transmit '\n1\c2You cannot move there now!'
  509. signal mainmenu
  510.  
  511. information:
  512. transmit '\f1\c1Ship information:'
  513. transmit "\n1    Pilot's Name: "pl.ur.1
  514. transmit "            Team: "pl.ur.2
  515. transmit "        Fighters: "pl.ur.3
  516. transmit " Sector Location: "sector
  517. transmit "      Turns Left: "turns
  518. transmit "     Cargo Holds: "pl.ur.7
  519. transmit "    Holds Status: "
  520. transmit "      # with Ore: "pl.ur.8
  521. transmit "      # with Org: "pl.ur.9
  522. transmit "      # with Eqp: "pl.ur.10
  523. transmit "    Sector Mines: "pl.ur.11
  524. transmit " Trading Credits: "pl.ur.12
  525. transmit "    Bank Credits: "pl.ur.13
  526. call key
  527. signal mainmenu
  528.  
  529. gamble:
  530. transmit '\c3You have a 50-50 chance of winning twice the amount you bet.'
  531. transmit 'You have 'pl.ur.12' credits that you can gamble.'
  532. aks='Bet how much [0]? '
  533. call askq
  534. an=compress(an)
  535. if an='' then signal mainmenu
  536. y=pl.ur.12
  537. x=random(1,2,time('s'))
  538. z=an
  539. if z<=0 then signal gamble
  540. if z>y then signal gamble
  541. if x>1 then do
  542. y=y-z
  543. z=z*2
  544. transmit '\n1You Won 'z' Credits!'
  545. y=y+z
  546. transmit 'You now have 'y' credits.'
  547. pl.ur.12=y
  548. signal mainmenu
  549. end
  550. transmit '\n1You Lost!'
  551. y=y-z
  552. transmit 'You have 'y' credits.'
  553. pl.ur.12=y
  554. signal mainmenu
  555.  
  556. fightercheck:
  557. if sd.9=ur then do
  558. x=0
  559. return
  560. end
  561. tnu=sd.9
  562. y=pl.tnu.2
  563. if y=0 then do
  564. x=1
  565. return
  566. end
  567. if sd.9>0 then do
  568. if y=pl.ur.2 then do
  569. x=0
  570. return
  571. end
  572. end
  573. x=1
  574. return
  575.  
  576. minecheck:
  577. tnu=sd.17
  578. if sd.17=ur then do
  579. x=0
  580. return
  581. end
  582. y=pl.tnu.2
  583. if sd.17>0 then do
  584. if y=pl.ur.2 then do
  585. x=0
  586. return
  587. end
  588. end
  589. x=1
  590. return
  591.  
  592. bank:
  593. transmit '\f1\c5'
  594. an='Welcome to the'
  595. call cnter
  596. an='FIRST INTERGALACTIC BANK'
  597. call cnter
  598. an='Auto-Transactor'
  599. call cnter
  600. an='----------------------------'
  601. call cnter
  602. bank2:
  603. transmit "   Today's interest rate is "c.1"%"
  604. transmit '\n1Trading Credits:   'pl.ur.12
  605. transmit 'Banking Credits:   'pl.ur.13
  606. transmit '\n1\c11\c5) Exit The Bank'
  607. transmit '\c12\c5) Deposit Credits'
  608. transmit '\c13\c5) Withdraw Credits (15% service charge)'
  609. sendstring '\n1Auto-Transactor Command (1,2,3)? '
  610. call ask
  611. if an=1 then signal mainmenu
  612. if an=2 then signal deposit
  613. if an=3 then signal withdraw
  614. signal bank2
  615. deposit:
  616. aks='You have 'pl.ur.12' credits. Deposit how many [0]? '
  617. call askq
  618. if an='' then signal bank2
  619. if an>pl.ur.12 then signal deposit
  620. if an<0 then signal deposit
  621. x=pl.ur.13
  622. y=an
  623. x=x+y
  624. pl.ur.13=x
  625. x=pl.ur.12
  626. x=x-y
  627. pl.ur.12=x
  628. signal bank2
  629. withdraw:
  630. aks='\n1You have 'pl.ur.13' bank credits. Withdraw how many [0]? '
  631. call askq
  632. if an='' then signal bank2
  633. if an>pl.ur.13 then signal withdraw
  634. if an<0 then signal withdraw
  635. x=an
  636. y=pl.ur.13
  637. z=trunc(.15 * x)
  638. if x+z>y then do
  639. transmit '\n1Not enough left over for service charge, please enter a new figure'
  640. signal withdraw
  641. end
  642. y=y-(x+z)
  643. pl.ur.13=y
  644. y=pl.ur.12
  645. y=y+x
  646. pl.ur.12=y
  647. transmit '\n1'z' credits taken for service charge.'
  648. signal bank2
  649.  
  650. cnter:
  651. sendstring center(an,linelength)
  652. return
  653.  
  654. fighters:
  655. transmit ''
  656. if sector=1 then do
  657. transmit 'No dropped fighters in sector 1!'
  658. signal mainmenu
  659. end
  660. temp=sd.9
  661. teamnumber=pl.temp.2
  662. if teamnumber=0 then teamnumber=99
  663. if sd.8>0 and pl.ur.2=teamnumber then signal fighters2
  664. if sd.8>0 & sd.9 ~= ur then do
  665. transmit '\c2You cannot drop your own fighters here!'
  666. signal mainmenu
  667. end
  668. fighters2:
  669. x=sd.8
  670. if sd.9=ur | pl.ur.2=teamnumber then do
  671. transmit 'Fighters Here:' x
  672. signal pickup
  673. end
  674. drop:
  675. transmit '\n1\c6You have \c1'pl.ur.3'\c6 fighters.'
  676. aks='\c3How many fighters do you wish to drop [\c10\c3]? \c7'
  677. call askq
  678. if an='' | an=0  then signal mainmenu
  679. if an>pl.ur.3 then do
  680. transmit '\n1\c2You do not have 'an' fighters!'
  681. signal fighters
  682. end
  683. if an<0 then do
  684. transmit '\n1\c2Get Real!'
  685. signal fighters
  686. end
  687. y=pl.ur.3
  688. y=y-an
  689. pl.ur.3=y
  690. sd.8=an
  691. x=ur
  692. sd.9=x
  693. call ws
  694. if ~exists(PFU'fighters') then do
  695. call open file, (PFU'fighters'), 'W'
  696. call writeln file, ''
  697. call close file
  698. end
  699. call open file, (PFU'fighters'), 'A'
  700. an = serialn||' '||sector||' 'sd.8
  701. call writeln file, an
  702. call close file
  703. transmit '\n1\c4Dropped.'
  704. signal mainmenu
  705. pickup:
  706. y=pl.ur.3
  707. y=y+x
  708. pl.ur.3=y
  709. sd.8=0
  710. sd.9=0
  711. call ws
  712. transmit '\n1\c4All Fighters Collected'
  713. call ldftr
  714.  
  715. searchun:
  716. x=0
  717. searchun2:
  718. x=x+1
  719. if x>y then signal mainmenu
  720. if sector = word(pd.x,2) then signal removef
  721. signal searchun2
  722.  
  723. removef:
  724. z=0
  725. removef2:
  726. z=z+1
  727. temp=y+1
  728. if z=temp then signal removef3
  729. temp=x+z
  730. an=x+z-1
  731. pd.an=pd.temp
  732. signal removef2
  733. removef3:
  734. y=y-2
  735. call open file, (PFU'fighters'), 'W'
  736. do z=1 to y
  737. call writeln file, pd.z
  738. end
  739. call close file
  740. drop pd
  741. signal mainmenu
  742.  
  743. attack:
  744. transmit '\n1\c6[\c1Attack Another Player\c6]'
  745. x=0
  746. attack1:
  747. x=x+1
  748. if x=41 then do
  749. transmit '\n1\c2No one To Fight.'
  750. signal mainmenu
  751. end
  752. if pl.x.4=sector & x ~= ur then do
  753. aks='\n1\c3Attack 'trim(pl.x.1)' ('pl.x.3' Fighters) [\c1N\c3]? \c7'
  754. call askq
  755. upper an
  756. if an='Y' then signal attack2
  757. end
  758. signal attack1
  759.  
  760. attack2:
  761. if pl.x.2=pl.ur.2 & pl.ur.2 ~= 0 then do
  762. transmit '\n1\c2You traitor, you cannot attack your own team members!'
  763. signal mainmenu
  764. end
  765. transmit '\n1\c5You have 'pl.ur.3' fighters.'
  766. aks='\c4Use how many fighters [\c10\c4]? \c7'
  767. call askq
  768. upper an
  769. if an='' then signal mainmenu
  770. transmit '\c6Attacking\c1!'
  771. f=0
  772. a=an
  773. bo=pl.x.3
  774. z=pl.ur.3
  775. if a<1 | a>pl.ur.3 then signal attack2
  776. bo=pl.x.3
  777. if pl.ur.3=0 then signal dead
  778. z=z-a
  779. pl.ur.3=z
  780.  
  781. attackloop:
  782. do until a<1 | bo<1
  783. c = random(0,1,time('s'))
  784. if c=0 then a=a-1
  785. if c=1 then do
  786. bo=bo-1
  787. f=f+1
  788. end
  789. if a<=0 then do
  790. transmit '\n1\c2You lost your fighters!'
  791. signal finishup
  792. end
  793. if bo<=0 then do
  794. transmit '\n1\c5You won!'
  795. signal winner
  796. end
  797. end
  798.  
  799. winner:
  800. z=pl.ur.3
  801. z=z+a
  802. pl.ur.3=z
  803. z=pl.ur.7
  804. y=random(0,pl.x.7,time('s'))
  805. z=z+y
  806. if z>60 then z=60
  807. pl.ur.7=z
  808. transmit '\n1\c4You managed to salvage \c1'y' \c4holds.'
  809. z=pl.ur.12
  810. y=pl.x.12
  811. z=z+y
  812. pl.ur.12=z
  813. transmit '\n1\c1You collected \c4'y' \c1credits.'
  814. pl.x.3=0
  815. pl.x.4=0
  816. pl.x.7=0
  817. call saveuser 
  818. hap=trim(pl.ur.1)' killed you.'
  819. call hapopen
  820.  
  821. fudge:
  822. a=trim(pl.ur.1)' killed 'trim(pl.x.1)
  823. call newspaperopen
  824. signal mainmenu
  825.  
  826. finishup:
  827. pl.x.3=bo
  828. call saveuser
  829. hap=strip(pl.ur.1)' destroyed 'f' of your fighters.'
  830. call hapopen
  831. if pl.ur.3=0 then do
  832. transmit 'You have no more fighters to protect you...'
  833. signal dead
  834. end
  835. signal mainmenu
  836.  
  837. mine:
  838. transmit '\n1\c1[\c2Drop Sector Mine\c1]'
  839. if sd.16>0 then do
  840. transmit '\n1\c4One is enough for now!'
  841. signal mainmenu
  842. end
  843. if pl.ur.11=0 then do
  844. transmit '\n1\c2Try buying one first!'
  845. signal mainmenu
  846. end
  847. if sector=1 then do
  848. transmit '\n1\c5No, not quite fair to put it here!'
  849. signal mainmenu
  850. end
  851. x=sd.2
  852. if x=0 & left(sdt.1,4) ~= 'None' then do
  853. transmit '\n1\c4Are you crazy? People have a right to fly here too!'
  854. signal mainmenu
  855. end
  856. x=pl.ur.11
  857. x=x-1
  858. pl.ur.11=x
  859. if pl.ur.2>0 then do
  860. transmit '\n1\c5This will be a team mine.'
  861. signal secnext
  862. end
  863. secnext:
  864. sd.17=ur
  865. sd.16=1
  866. call ws
  867. transmit '\n1\c7Mine dropped in sector \c3'sector'\c7.'
  868. a=trim(pl.ur.1)' dropped a mine somewhere!'
  869. call newspaperopen
  870. signal mainmenu
  871.  
  872. mineexp:
  873. x=random(0,2,time('s'))
  874. if x=1 then do
  875. transmit '\n1\c1You are lucky that mine was a dud!'
  876. signal mend
  877. end
  878. transmit '\n1\c4Uh-Oh!    ...   B O O M !'
  879. transmit '\n1\c4You just lost 1/2 your cargo and 10% of your holds!'
  880. x=pl.ur.8
  881. x=x/2
  882. pl.ur.8=x%1
  883. x=pl.ur.9
  884. x=x/2
  885. pl.ur.9=x%1
  886. x=pl.ur.10
  887. x=x/2
  888. pl.ur.10=x%1
  889. x=pl.ur.7*0.1
  890. x=x%1
  891. y=pl.ur.7
  892. y=y-x
  893. pl.ur.7=y
  894. mend:
  895. sd.16=0
  896. sd.17=0
  897. call ws
  898. signal mainmenu
  899.  
  900. computer:
  901. transmit '\n1\c6[\c1Computer Activated\c6]'
  902.  
  903. computermain:
  904. sendstring '\n1\c4Computer Command (F,G,M,P,Q,R,S,?)? \c7'
  905. call ask
  906. upper an
  907. if an='' then signal computermain
  908. if an='Q' then do
  909. transmit '\n1\c6[\c1Computer Deactivated\c6]'
  910. call ds
  911. signal mainmenu
  912. end
  913. if an='P' then signal preport
  914. if an='R' then signal rankplay
  915. if an='M' then signal sendmessage
  916. if an='G' then signal newspaper
  917. if an='F' then signal findfight
  918. if an='S' then signal scan
  919. if an='?' then do
  920. sendfile PF'computer.help'
  921. signal computermain
  922. end
  923. signal computermain
  924.  
  925. newspaper:
  926. transmit '\n1\c1[\c5Read Galactic Newspaper\c1]\c3'
  927. sendfile PF'paper.tw'
  928. signal computermain
  929.  
  930. preport:
  931. aks='\c6What sector number is the port in? \c1'
  932. call askq
  933. if an='' | an=0 then signal computermain
  934. if an<0 | an>ns then signal computermain
  935. x=an
  936. if x<1 or x>ns then do
  937. transmit '\n1\c2Idiot!'
  938. signal computermain
  939. end
  940. xon=sector
  941. sector=x
  942. call sectordata
  943. if upper(sdt.1)='NONE' then do
  944. transmit "\n1\c5If there is a port in that sector, I don't know about it!"
  945. sector=xon
  946. call sectordata
  947. signal computermain
  948. end
  949. transmit '\c1Commerce report for 'sdt.1''date()
  950. z=sd.2
  951. if z=0 then signal class0
  952. transmit ''
  953. call portstat
  954. signal commend
  955. class0:
  956. transmit '\c5Cargo Holds    \c2: \c1'sd.19' \c5credits/hold'
  957. transmit '\c5Fighters       \c2: \c1'sd.18' \c5credits/fighter'
  958. transmit '\c5Turns          \c2: \c1'sd.20' \c5credits/turn'
  959. transmit '\c5Mines          \c2: \c14,000 \c5credits each'
  960.  
  961. commend:
  962. sector=xon
  963. call sectordata
  964. signal computermain
  965.  
  966. portstat:
  967. x=sd.2
  968. z=1
  969. if x=1 then do
  970. if left(sd.23,1)='.' then do
  971. sd.12=1000;sd.14=1000
  972. end
  973. tt.1='Selling';y=sd.10;call change;sd.10=y
  974. tt.2='Buying ';y=sd.12;call change2;sd.12=y 
  975. tt.3='Buying ';y=sd.14;call change2;sd.14=y
  976. end
  977. x=sd.2
  978. if x=2 then do
  979. if left(sd.23,1)='.' then do
  980. sd.10=1000;sd.14=1000
  981. end
  982. tt.1='Buying ';y=sd.10;call change2;sd.10=y
  983. tt.2='Selling';y=sd.12;call change;sd.12=y
  984. tt.3='Buying ';y=sd.14;call change2;sd.14=y
  985. end
  986. x=sd.2
  987. if x=3 then do
  988. if left(sd.23,1)='.' then do
  989. sd.10=1000;sd.12=1000
  990. end
  991. tt.1='Buying ';y=sd.10;call change2;sd.10=y
  992. tt.2='Buying ';y=sd.12;call change2;sd.12=y
  993. tt.3='Selling';y=sd.14;call change;sd.14=y
  994. end
  995. tt.4=sd.10
  996. tt.5=sd.12
  997. tt.6=sd.14
  998. sd.23=date()
  999. call ws
  1000. transmit '\n1\c3Type       Status   #'
  1001. transmit '\c1========================'
  1002. transmit '\c7Organics   'tt.1'  'tt.4
  1003. transmit 'Ore        'tt.2'  'tt.5
  1004. transmit 'Equipment  'tt.3'  'tt.6
  1005. transmit ''
  1006. return
  1007.  
  1008. sendmessage:
  1009. transmit '\n1\c6[\c1Send A Message\c6]'
  1010. aks='\n1\c3To whom is this message addressed(or ALL)? \c7'
  1011. call askq
  1012. upper an
  1013. if an='' then signal computermain
  1014. if an='ALL' then do;tt.1=an;x='1ALL';signal sendm;end
  1015. if an=upper(pl.ur.1) | left(an,1)='.' then do
  1016. transmit '\n1\c2Are you feeling ok?'
  1017. signal computermain
  1018. end
  1019. x=0
  1020. serloop:
  1021. x=x+1
  1022. if x=ur then signal serloop
  1023. if x=41 then do
  1024. transmit '\n1\c2User Not Found.'
  1025. signal computermain
  1026. end
  1027. a=length(an)
  1028. bo=left(pl.x.1,a)
  1029. if upper(bo)=an then do
  1030. transmit '\n1\c5User Found.'
  1031. tt.1=trim(pl.x.1)
  1032. signal sendm
  1033. end
  1034. signal serloop
  1035.  
  1036. sendm:
  1037. aks='\n1\c4Send a message to 'tt.1' [\c1N\c4]? \c7'
  1038. call askq
  1039. upper an
  1040. if an='' then signal computermain
  1041. if an='Y' then signal sm2
  1042. signal computermain
  1043.  
  1044. sm2:
  1045. tt.2='';tt.3='';tt.4='';tt.5='';tt.6=''
  1046. number=x
  1047. transmit '\n1       [----------------------------------------]'
  1048. aks='Title  '
  1049. call askq
  1050. if an='' then signal computermain
  1051. tt.1=an
  1052. transmit '\n1You have up to 5 lines (blank line will save message).\n1'
  1053. query 
  1054. an=result
  1055. tt.2=an
  1056. if an='###PANIC' then signal end2
  1057. if an='' then signal sve
  1058. query
  1059. an=result
  1060. tt.3=an
  1061. if an='###PANIC' then signal end2
  1062. if an='' then signal sve
  1063. query
  1064. an=result
  1065. tt.4=an
  1066. if an='###PANIC' then signal end2
  1067. if an='' then signal sve
  1068. query
  1069. an=result
  1070. tt.5=an
  1071. if an='###PANIC' then signal end2
  1072. if an='' then signal sve
  1073. query
  1074. an=result
  1075. tt.6=an
  1076. if an='###PANIC' then signal end2
  1077. sve:
  1078. if exists(PF''number'.msg') then do
  1079. call open file, (PF''number'.msg'), 'A'
  1080. signal sve2
  1081. end
  1082. call open file, (PF''number'.msg'), 'W'
  1083.  
  1084. sve2:
  1085. tt.1=left(tt.1,40)
  1086. tt.2=left(tt.2,78)
  1087. tt.3=left(tt.3,78)
  1088. tt.4=left(tt.4,78)
  1089. tt.5=left(tt.5,78)
  1090. tt.6=left(tt.6,78)
  1091. tt.1=trim(tt.1)
  1092. an='\n2Title    : 'tt.1' (Private)' 
  1093. if right(number,3) = 'ALL' then do
  1094. an='\n2Title    : 'tt.1' (To All)'
  1095. end
  1096. call writeln file, an
  1097. an='Player   : 'pl.ur.1
  1098. call writeln file, an
  1099. an='Date/Time: '||date('u')||' / '||time()
  1100. call writeln file, an
  1101. an='--------------------------------------'
  1102. call writeln file, an
  1103. tt.2=trim(tt.2)
  1104. call writeln file, tt.2
  1105. tt.3=trim(tt.3)
  1106. call writeln file, tt.3
  1107. tt.4=trim(tt.4)
  1108. call writeln file, tt.4
  1109. tt.5=trim(tt.5)
  1110. call writeln file, tt.5
  1111. tt.6=trim(tt.6)
  1112. call writeln file, tt.6
  1113. call writeln file, '\n1End of Message. Press Return.\i1'
  1114. call close file
  1115. transmit '\n1Message Sent.'
  1116. drop tt
  1117. signal computermain
  1118.  
  1119. findfight:
  1120. transmit '\n1\c1[\c4Locate All Of Your Fighters\c1]\c3\n1'
  1121. xon=0
  1122. x=0
  1123. call ldftr
  1124. ff1:
  1125. x=x+1
  1126. if x>y then do
  1127. if xon=0 then transmit '\c2No Fighters!'
  1128. signal computermain
  1129. end
  1130. if word(pd.x,1)=serialn then do
  1131. an=word(pd.x,2)
  1132. z=word(pd.x,3)
  1133. xon=1
  1134. transmit '\n1\c5Sector  :\c7 '||an
  1135. transmit '\c5Fighters: \c7'||z
  1136. end
  1137. signal ff1
  1138.  
  1139. scan:
  1140. transmit '\n1\c7[\c5Scan Adjacent Sector\c7]'
  1141. z=sector
  1142. sendstring '\n1\c3Warps lead to 'sdt.3
  1143. if sdt.4 ~= '' then sendstring ', 'sdt.4
  1144. if sdt.5 ~= '' then sendstring ', 'sdt.5
  1145. if sdt.6 ~= '' then sendstring ', 'sdt.6
  1146. if sdt.21 ~= '' then sendstring ', 'sdt.21
  1147. if sdt.22 ~= '' then sendstring ', 'sdt.22
  1148. aks='\n1Scan which? '
  1149. query aks
  1150. an=result
  1151. an=strip(an)
  1152. if an='###PANIC' then do
  1153. sector=z
  1154. call sectordata  
  1155. signal end2
  1156. end
  1157. if an='' then do
  1158. sector=z
  1159. call sectordata
  1160. signal computermain
  1161. end
  1162. x=an
  1163. if x=0 then x=1000000
  1164. if left(x,1)='0' then x=1000000
  1165. if x=sdt.3 | x=sdt.4 | x=sdt.5 | x=sdt.6 | x=sdt.21 | x=sdt.22 then do
  1166. sector=x
  1167. call ds
  1168. transmit ''
  1169. sector=z
  1170. call sectordata
  1171. signal computermain
  1172. end
  1173. transmit "\n1\c2Can't you read? It says ADJACENT sectors!"
  1174. sector=z
  1175. signal computermain
  1176.  
  1177. attackf:
  1178. transmit '\n1\c6[\c1You are being attacked!\c6]'
  1179. attackf1:
  1180. transmit '\n1\c4Theirs \c1= \c7'sd.8
  1181. transmit '\c4Yours  \c1= \c7'pl.ur.3
  1182. aks='\n1\c1[\c4A\c1]ttack or [\c4E\c1]scape? \c3'
  1183. call askq
  1184. upper an
  1185. if an='A' then signal attackf2
  1186. if an='E' then signal escape
  1187. signal attackf1
  1188.  
  1189. escape:
  1190. x=random(0,2,time('s'))
  1191. if x=0 then do
  1192. transmit "\n1\c2You didn't escape!"
  1193. x=pl.ur.3
  1194. xt=x/2
  1195. y=random(0,x-xt,time('s'))
  1196. x=x-y
  1197. pl.ur.3=x
  1198. transmit '\c5You lost \c7'y' \c5fighters in this process.'
  1199. if pl.ur.3=0 then signal dead
  1200. signal attackf
  1201. end
  1202. transmit '\n1\c5You escaped!'
  1203. sector=ls
  1204. call ds
  1205. signal mainmenu
  1206.  
  1207. attackf2:
  1208. if pl.ur.3=0 then signal dead
  1209. transmit '\n1You have 'pl.ur.3' fighters.'
  1210. aks='Use how many fighters [0]? '
  1211. call askq
  1212. if an='' then signal attackf1
  1213. f=0
  1214. a=an
  1215. bo=sd.8
  1216. z=pl.ur.3
  1217. if a<1 | a>pl.ur.3 then signal attackf2
  1218. z=z-a
  1219. pl.ur.3=z
  1220.  
  1221. attackloopf:
  1222. do until a<1 | bo<1 
  1223. c=random(0,1,time('s'))
  1224. if c=0 then a=a-1
  1225. if c=1 then do
  1226. bo=bo-1
  1227. f=f+1
  1228. end
  1229. if a<=0 then do
  1230. transmit '\n1\c2You lost your fighters!'
  1231. signal finishupf
  1232. end
  1233. if bo<=0 then do
  1234. transmit '\n1\c5You won!'
  1235. signal winnerf
  1236. end
  1237. end
  1238.  
  1239. finishupf:
  1240. z=sd.8-bo
  1241. sd.8=bo
  1242. signal fightfend
  1243.  
  1244. winnerf:
  1245. z=sd.8-bo
  1246. sd.8=0
  1247. y=pl.ur.3
  1248. y=y+a
  1249. pl.ur.3=y
  1250.  
  1251. fightfend:
  1252. if sd.9=99 then do
  1253. y=z*c.2
  1254. x=pl.ur.12
  1255. x=x+y
  1256. pl.ur.12=x
  1257. if z>0 then do
  1258. transmit '\n1\c1You collected 'y' credits for destroying 'z' Cabal.'
  1259. if exists(PF'cabal') then do
  1260. call open file, (PF'cabal'), 'R'
  1261. y=readln(file)
  1262. z=z+y
  1263. call close file
  1264. end
  1265. call open file, (PF'cabal'), 'W'
  1266. call writeln file, z
  1267. call close file
  1268. end
  1269. end
  1270. if sd.9 ~= 99 then do
  1271. temp=sd.9
  1272. if z>1 then do
  1273. a=pl.ur.1' destroyed 'z' fighters belonging to 'trim(pl.temp.1)
  1274. call newspaperopen
  1275. if sd.8= 0 then sd.9=0
  1276. end
  1277. end
  1278. x=sd.9
  1279. call ws
  1280. if sd.8>0 then signal attackf1
  1281. signal mainmenu
  1282.  
  1283. dead:
  1284. transmit "\n1\c2You're history buddy!"
  1285. a=trim(pl.ur.1)' was killed by an enemy!'
  1286. call newspaperopen
  1287. pl.ur.3=0
  1288. pl.ur.4=0
  1289. pl.ur.7=0
  1290. pl.ur.6=date('u')
  1291. pl.ur.14=date('c')
  1292. x=ur
  1293. call saveuser
  1294. signal end
  1295.  
  1296. port:
  1297. if upper(sdt.1)='NONE' then do
  1298. transmit '\n1\c2Are you seeing things? There is no port in this sector!'
  1299. signal mainmenu
  1300. end
  1301. transmit '\n1\c6[\c1Port and Trade\c6]'
  1302. transmit '\n1\c2*Deducting One Turn For Docking*'
  1303. turns=turns-1
  1304. transmit '\c2*You have \c1'turns' \c2turns left*'
  1305. transmit '\n1\c6Docked In : \c1'sdt.1' ['date' / 'time()']'
  1306. if pl.ur.7='' then pl.ur.7=0
  1307. if pl.ur.8='' then pl.ur.8=0
  1308. if pl.ur.9='' then pl.ur.9=0
  1309. if pl.ur.10='' then pl.ur.10=0
  1310. if right(sdt.2,1)=0 then signal clss0
  1311. signal clss123
  1312. clss0:
  1313. if sd.23 ~= date then do
  1314. x=random(0,20,time('s')) + 90
  1315. sd.18=x
  1316. x=random(0,30,time('s')) + 485
  1317. sd.19=x
  1318. x=random(0,40,time('s')) + 280
  1319. sd.20=x
  1320. sd.23=date
  1321. call ws
  1322. end
  1323. transmit '\n1\c5Cargo holds    \c2: \c7'sd.19' \c5credits/hold'
  1324. transmit '\c5Fighters       \c2: \c7'sd.18' \c5credits/fighter'
  1325. transmit '\c5Turns          \c2: \c7'sd.20' \c5credits/turns'
  1326. transmit '\c5Mines          \c2: \c74,000 \c5credits each'
  1327. tt.1='holds';z=7;temp=sd.19;call buy0p
  1328. tt.1='fighters';z=3;temp=sd.18;call buy0p
  1329. tt.1='turns';z=5;temp=sd.20;call buy0p
  1330. tt.1='mines';z=11;temp=4000;call buy0p
  1331. signal mainmenu
  1332.  
  1333. buy0p:
  1334. transmit '\n1('pl.ur.12' credits)'
  1335. xon=pl.ur.12 / temp
  1336. xon=xon+0.001
  1337. if z=7 then do
  1338. if 60-pl.ur.7<xon then xon=60-pl.ur.7+0.001
  1339. end
  1340. xon=trunc(xon)
  1341. aks='\c4How many 'tt.1' do you wish to buy (\c1'xon' = max\c4) [\c10\c4]? \c3'
  1342. call askq
  1343. if an='' | an<1 then return
  1344. if datatype(an)~='NUM' then signal buy0p
  1345. y=an+pl.ur.z
  1346. if an>xon then signal buy0p
  1347. xon=temp*an
  1348. if z ~= 5 then do
  1349. pl.ur.z=pl.ur.z+an
  1350. end
  1351. if z=5 then do
  1352. turns=turns+an
  1353. end
  1354. pl.ur.12=pl.ur.12-xon
  1355. return
  1356.  
  1357. clss123:
  1358. call portstat
  1359. x=sd.2
  1360. if x=1 then do
  1361. call bore
  1362. call bequ
  1363. call sorg
  1364. end
  1365. if x=2 then do
  1366. call borg
  1367. call bequ
  1368. call sore
  1369. end
  1370. if x=3 then do
  1371. call borg
  1372. call bore
  1373. call sequ
  1374. end
  1375. sd.23=date()
  1376. call ws
  1377. signal mainmenu
  1378.  
  1379. buysell:
  1380. if typeb=0 then do
  1381. temp=comm+7
  1382. typec=pl.ur.temp
  1383. end
  1384. if typeb=1 then do
  1385. temp=pl.ur.8+pl.ur.9+pl.ur.10
  1386. typec=pl.ur.7-temp
  1387. if typec<=0 then signal osend    
  1388. end
  1389. if typec=0 & typeb ~= 1 then signal osend
  1390.  
  1391. os2:
  1392. temp=comp+8
  1393. y=sd.temp
  1394. transmit ''
  1395. ab='buying'
  1396. if typeb>0 then ab='selling'
  1397. comms='Ore'
  1398. if comm=2 then comms='Organics'
  1399. if comm=3 then comms='Equipment'
  1400. transmit 'We are 'ab' 'y' units of 'comms
  1401. ab='Sell'
  1402. if typeb>0 then ab='Buy'
  1403. if typec>y then typec=y
  1404. sendstring ab' how many ['typec']? '
  1405. query ''
  1406. an=result
  1407. if an='###PANIC' then signal end2
  1408. ab=an
  1409. if an='' then ab=typec
  1410. if ab=0 then signal osend
  1411. if ab<1 | ab>typec then signal os2
  1412. d=1 
  1413. typet=comp+9
  1414. bo=ab*typet
  1415. e=bo*.07%1
  1416. if typeb=0 then e=e+bo
  1417. if typeb>0 then e=bo-e
  1418.  
  1419. haggleorg:
  1420. if d>1 & typeb ~= 1 then do
  1421. tt.1=ab*typet
  1422. temp=e-tt.1
  1423. temp=(temp/3)%1
  1424. bo=bo+temp
  1425. end
  1426. if d>1 & typeb>0 then do
  1427. tt.1=ab*typet
  1428. temp=tt.1-e
  1429. temp=(temp/3)%1
  1430. bo=bo-temp
  1431. end
  1432. if d=4 then do
  1433. transmit 'Forget it! Go Away!'
  1434. signal osend
  1435. end
  1436. ho2:
  1437. transmit ''
  1438. a='We will buy them for 'bo' credits.'
  1439. if typeb>0 then a='We will sell them for 'bo' credits.'
  1440. transmit a
  1441. aks='Your offer? '
  1442. call askq
  1443. if an>pl.ur.12 & typeb=1 then do
  1444. transmit '\n1You don''t have that much!'
  1445. transmit 'You have 'pl.ur.12' credits.'
  1446. signal ho2
  1447. end
  1448. if an='' then do
  1449. signal ho2
  1450. end
  1451. if an=0 then signal osend
  1452. if typeb=0 then do
  1453. if an<=bo | an<=e then do
  1454. bo=an
  1455. signal orgdeal
  1456. end
  1457. end
  1458. if typeb>0 then do
  1459. if an>=bo | an>=e then do
  1460. bo=an
  1461. signal orgdeal
  1462. end
  1463. end
  1464. transmit '\n1Ha Ha! I don''t think so!'
  1465. d=d+1
  1466. signal haggleorg
  1467.  
  1468. orgdeal:
  1469. if typeb>0 then signal orgdeal2
  1470. transmit '\n1Agreed!'
  1471. y=pl.ur.12
  1472. y=y+bo
  1473. pl.ur.12=y
  1474. temp=comp+8
  1475. y=sd.temp
  1476. y=y-ab
  1477. sd.temp=y
  1478. temp=comm+7
  1479. y=pl.ur.temp
  1480. y=y-ab
  1481. pl.ur.temp=y
  1482. signal osend
  1483.  
  1484. orgdeal2:
  1485. transmit '\n1Ok! Sure!'
  1486. y=pl.ur.12
  1487. y=y-bo
  1488. pl.ur.12=y
  1489. temp=comm+7 
  1490. y=pl.ur.temp
  1491. y=y+ab
  1492. pl.ur.temp=y
  1493. temp=comp+8
  1494. y=sd.temp
  1495. y=y-ab
  1496. sd.temp=y
  1497.  
  1498. osend:
  1499. return
  1500.  
  1501. change:
  1502. if sd.23 ~=date() then do
  1503. y=y+100
  1504. if y>750 then y=750
  1505. end
  1506. x=750/y
  1507. x=x+z
  1508. x=x%1
  1509. return
  1510.  
  1511. change2:
  1512. if sd.23 ~=date() then do
  1513. tt.4=.12*y
  1514. y=y+tt.4
  1515. y=y%1
  1516. if y>1000 then y=1000
  1517. end
  1518. x=(y/1000)*z
  1519. x=x+z
  1520. x=x%1
  1521. return
  1522.  
  1523. sorg:
  1524. y=sd.10
  1525. z=20
  1526. call change
  1527. sd.10=y
  1528. sd.11=x
  1529. typeb=1
  1530. comm=2
  1531. comp=2
  1532. call buysell
  1533. return
  1534.  
  1535. sore:
  1536. y=sd.12
  1537. z=10
  1538. call change
  1539. sd.12=y
  1540. sd.13=x
  1541. typeb=1
  1542. comm=1
  1543. comp=4
  1544. call buysell
  1545. return
  1546.  
  1547. sequ:
  1548. y=sd.14
  1549. z=30
  1550. call change
  1551. sd.14=y
  1552. sd.15=x
  1553. typeb=1
  1554. comm=3
  1555. comp=6
  1556. call buysell
  1557. return
  1558.  
  1559. borg:
  1560. y=sd.10
  1561. z=20
  1562. call change2
  1563. sd.10=y
  1564. sd.11=x
  1565. typeb=0
  1566. comm=2
  1567. comp=2
  1568. call buysell
  1569. return
  1570.  
  1571. bore:
  1572. y=sd.12
  1573. z=10
  1574. call change2
  1575. sd.12=y
  1576. sd.13=x
  1577. typeb=0 
  1578. comm=1
  1579. comp=4
  1580. call buysell
  1581. return
  1582.  
  1583. bequ:
  1584. y=sd.14
  1585. z=30
  1586. call change2
  1587. sd.14=y
  1588. sd.15=x
  1589. typeb=0
  1590. comm=3
  1591. comp=6
  1592. call buysell
  1593. return
  1594.  
  1595. rankplay:
  1596. sendstring '\f1\c4Ranking Players...'
  1597. if exists(PF'rank.temp') then do
  1598. address command 'delete 'PF'rank.temp'
  1599. address command 'delete 'PF'rank'
  1600. end
  1601. if exists(PF'team.temp') then do
  1602. address command 'delete 'PF'team.temp'
  1603. address command 'delete 'PF'rankt'
  1604. end
  1605. call ldftr
  1606. call teloop
  1607. do x=1 to 10
  1608. tt.x=0
  1609. end
  1610. x=0
  1611. call open file, (PF'rank.temp'), 'W'
  1612. bo=0
  1613. rp2:
  1614. x=x+1
  1615. if x>40 then do
  1616. x=0
  1617. call close file
  1618. signal rp3
  1619. end
  1620. u=pl.x.1
  1621. if pl.x.2>0 then u=u||' ['pl.x.2']'
  1622. if left(u,2)='..' then signal rp2
  1623. sendstring '.'
  1624. w=0
  1625. temp=0
  1626. buck=pl.x.3
  1627. do i=1 to y
  1628. if word(pd.i,1)=pl.x.15 & pl.x.15 ~=0 then do
  1629. z=word(pd.i,3)
  1630. if z='' then z=0
  1631. buck=buck+z
  1632. end
  1633. end
  1634. if buck='' then buck=0
  1635. temp=100*buck
  1636. w=w+temp
  1637. buck=pl.x.7
  1638. if buck='' then buck=0
  1639. temp=500*buck
  1640. w=w+temp
  1641. buck=pl.x.11
  1642. if buck = '' then buck=0
  1643. temp=4000*buck
  1644. w=w+temp
  1645. if pl.x.12='' then pl.x.12=0
  1646. if pl.x.13='' then pl.x.13=0
  1647. w=w+pl.x.12
  1648. w=w+pl.x.13
  1649. if pl.x.4=0 then w=0
  1650. temp=right(w,9,'0')
  1651. if pl.x.4=0 then temp='     Dead'
  1652. a=temp'   'u
  1653. call writeln file, a
  1654. if pl.x.2>0 then do
  1655. bo=1
  1656. teamnumber=pl.x.2
  1657. if pl.x.4 ~= 0 then do
  1658. tt.teamnumber=tt.teamnumber+w
  1659. end
  1660. end
  1661. signal rp2
  1662.  
  1663. rp3:
  1664. if bo=1 then do
  1665. call open file, (PF'team.temp'), 'W'
  1666. do x=1 to 10
  1667. if tt.x>0 then do
  1668. an=right(tt.x,9,'0')'   ['|| x ||'] 'tn.x
  1669. call writeln file, an
  1670. end
  1671. end
  1672. call close file
  1673. address command 'sort 'PF'team.temp 'PF'rankt'
  1674. end
  1675. address command 'sort 'PF'rank.temp 'PF'rank'
  1676.  
  1677. rp4:
  1678. transmit '\f1\c3## Value       Name [Team]'
  1679. transmit '\c1--------------------------------------\c7'
  1680. call open file, (PF'rank'), 'R'
  1681. x=0
  1682. call rp5
  1683. transmit '\n1\c3## Value       Team'
  1684. transmit '\c1--------------------------------------\c7'
  1685. if exists(PF'rankt') then do
  1686. call open file, (PF'rankt'), 'R'
  1687. x=0
  1688. call rp5
  1689. end
  1690. drop i. bo. x. y. u. z. buck. w. temp. a. tt. pd. tn. tle. tpd.
  1691. signal computermain
  1692. rp5:
  1693. x=x+1
  1694. if ~eof(file) then do
  1695. tt.x=readln(file)
  1696. signal rp5
  1697. end
  1698. call close file
  1699. temp=0
  1700. y=x-1
  1701. rp6:
  1702. y=y-1
  1703. if y=0 then return
  1704. temp=temp+1
  1705. u=left(tt.y,9)
  1706. if u ~= '     Dead' then do
  1707. u=u/1
  1708. end
  1709. u=right(u,9,' ')
  1710. z=overlay(u,tt.y)
  1711. w=right(temp,2,' ')
  1712. transmit w' 'z
  1713. signal rp6
  1714.  
  1715. team:
  1716. transmit '\n1\c6[\c1Team Menu\c6]'
  1717. ldteams=1
  1718. team2:
  1719. if ldteams=1 then call teloop
  1720. sendstring '\n1\c4(C,D,F,J,L,M,N,P,Q,R,S,X,?)? \c7'
  1721. call ask
  1722. if an='###PANIC' then signal end2
  1723. if an='Q' then do
  1724. drop tn tle tpd tt y x fle
  1725. signal mainmenu
  1726. end
  1727. if an='M' then signal createt
  1728. if an='J' then signal joint
  1729. if an='X' then signal quitt
  1730. if an='C' then do;tt.1='Credits';y=12;signal casht;end
  1731. if an='F' then do;tt.1='Fighters';y=3;signal casht;end
  1732. if an='S' then signal seart
  1733. if an='L' then signal trant
  1734. if an='P' then do;tt.1='Password';y=0;signal chant;end
  1735. if an='D' then signal rant
  1736. if an='N' then do;tt.1='Name';y=1;signal chant;end
  1737. if an='R' then signal kick
  1738. if an='?' then do
  1739. sendfile PF'team.help'
  1740. signal team2
  1741. end
  1742. signal team2
  1743.  
  1744. teloop:
  1745. x=0
  1746. teloop2:
  1747. x=x+1
  1748. if x>10 then return
  1749. fle=PFT't' x
  1750. call open file, (fle), 'R'
  1751. tn.x=readln(file)
  1752. tle.x=readln(file)
  1753. tpd.x=readln(file)
  1754. call close file
  1755. ldteams=0
  1756. signal teloop2
  1757.  
  1758. createt:
  1759. transmit '\n1\c6[\c1Create A New Team\c6]\n1'
  1760. if pl.ur.2>0 then do
  1761. transmit '\n1\c2You MUST quit the team you are on to create a new team.'
  1762. signal team2
  1763. end
  1764. transmit '\c4Searching for an open team slot\c1...'
  1765. x=0
  1766. createt2:
  1767. x=x+1
  1768. if x>10 then do
  1769. transmit '\n1\c2Sorry, there are no spaces available.'
  1770. transmit 'Please join a team or try again later.'
  1771. signal team2
  1772. end
  1773. if tn.x='..' then do
  1774. ftem=x
  1775. signal fouteam
  1776. end
  1777. signal createt2
  1778.  
  1779. fouteam:
  1780. transmit '\n1\c3Team \c1'ftem' \c3is available.\n1'
  1781. sendstring '\c7Please enter a name for your team\n1: \c1'
  1782. query
  1783. an=result
  1784. if an='###PANIC' then signal end2
  1785. if an='' then signal team2
  1786. tn.ftem=an
  1787. sendstring '\n1\c7Please enter a password for your team\n1: \c1'
  1788. query
  1789. an=upper(result)
  1790. if an='###PANIC' then signal end2
  1791. if an='' then signal team2
  1792. tpd.ftem=an
  1793. transmit '\n1\c4Creating team file\c1...'
  1794. pl.ur.2=ftem
  1795. fle=PFT't' ftem
  1796. call open file, (fle), 'W'
  1797. call writeln file, tn.ftem
  1798. call writeln file, pl.ur.1
  1799. call writeln file, tpd.ftem
  1800. call close file
  1801. transmit '\c5Team created!'
  1802. a=pl.ur.1' created a team named 'tn.ftem' ['ftem']'
  1803. call newspaperopen
  1804. ldteams=1
  1805. signal team2
  1806.  
  1807. joint:
  1808. transmit '\n1\c6[\c1Join A Team\c6]\n1'
  1809. if pl.ur.2>0 then do
  1810. transmit '\c2You MUST quit the team you are on first.'
  1811. signal team2
  1812. end
  1813. transmit '\c7Current Team List:\c3'
  1814. x=0
  1815. do x=1 to 10
  1816. if tn.x ~= '..' then do
  1817. transmit 'Team #' x '  Name: ' tn.x
  1818. transmit 'Leader: 'tle.x
  1819. transmit ''
  1820. end
  1821. end
  1822. sendstring '\n1\c7What team do you want to join? \c1'
  1823. query
  1824. an=upper(result)
  1825. if an='###PANIC' then signal end2
  1826. if an='' then signal team2
  1827. if an<1 | an>10 then signal team2
  1828. if tn.an='..' then do
  1829. transmit '\n1\c2Does that look like a team to you?'
  1830. signal team2
  1831. end
  1832. teamnumber=an
  1833. passtest=upper(tpd.teamnumber)
  1834. sendstring '\n1\c4Password? \c1'
  1835. query
  1836. an=upper(result)
  1837. if an='' then signal team2
  1838. if an='###PANIC' then call end2
  1839. if an=passtest then do
  1840. pl.ur.2=teamnumber
  1841. transmit '\c7You are now a member of team number 'teamnumber
  1842. a=pl.ur.1' joined team #'teamnumber
  1843. call newspaperopen
  1844. signal team2
  1845. end
  1846. transmit "\n1\c2Sorry. That wasn't the password"
  1847. signal team2
  1848.  
  1849. quitt:
  1850. transmit '\n1\c6[\c1Quit Team\c6]\n1'
  1851. sendstring '\c5Do you really want to quit your team? \c7'
  1852. call ask
  1853. if an='Y' then do
  1854. teamnumber=pl.ur.2
  1855. if tle.teamnumber=pl.ur.1 then do;x=ur;signal disband2;end
  1856. pl.ur.2=0
  1857. transmit '\n1\c2You are no longer in a team.'
  1858. a=pl.ur.1' quit team #'teamnumber
  1859. signal team2
  1860. end
  1861. signal team2
  1862.  
  1863. rant:
  1864. transmit '\n1\c6[\c1Disband Team\c6]\n1'
  1865. teamnumber=pl.ur.2
  1866. if tle.teamnumber ~= pl.ur.1 then do
  1867. transmit '\c2You are not the captain of that team!'
  1868. signal team2
  1869. end
  1870. sendstring '\c4Do you really want to disband? \c1'
  1871. call ask
  1872. if an='Y' then do
  1873. signal disband2
  1874. end
  1875. signal team2
  1876. x=ur
  1877.  
  1878. disband2:
  1879. teamnumber=pl.x.2
  1880. transmit '\n1\c5Disbanding team. Please wait while members are purged.'
  1881. x=0
  1882. do x=1 to 40
  1883. if pl.x.2=teamnumber then do
  1884. pl.x.2=0
  1885. call saveuser
  1886. end
  1887. end
  1888. a=tn.teamnumber' disbanded.'
  1889. call newspaperopen
  1890. tn.teamnumber='..'
  1891. call saveteam
  1892. ldteams=1
  1893. transmit '\c3Team disbanded.'
  1894. if capkill=1 then return
  1895. signal team2
  1896.  
  1897. casht:
  1898. transmit '\n1\c6[\c1Transfer 'tt.1'\c6]\n1'
  1899. if pl.ur.2=0 then do
  1900. transmit '\c1You are not on a team!'
  1901. signal team2
  1902. end
  1903. sendstring '\c4Do you want to send 'tt.1'? \c7'
  1904. call ask
  1905. if an='Y' then signal casht2
  1906. signal team2
  1907. casht2:
  1908. transmit '\n1\c2Checking sector\c1...'
  1909. x=0
  1910. casht3:
  1911. x=x+1
  1912. if x>40 then signal casht4
  1913. if x=ur then signal casht3
  1914. if pl.x.4=sector & pl.x.2=pl.ur.2 then do
  1915. sendstring '\n1\c3Transfer 'tt.1' to 'pl.x.1'? '
  1916. call ask
  1917. if an='Y' then do
  1918. transmit 'You have 'pl.ur.y' 'tt.1' available for transfer.'
  1919. sendstring 'How much? '
  1920. query
  1921. an=result
  1922. if an='###PANIC' then call end2
  1923. if an>0 & an<=pl.ur.y then do
  1924. pl.ur.y=pl.ur.y-an
  1925. pl.x.y=pl.x.y+an
  1926. call saveuser
  1927. hap=pl.ur.1' gave you '||an||' '||tt.1'.'
  1928. call hapopen
  1929. transmit tt.1' transferred.'
  1930. signal casht3
  1931. end
  1932. end
  1933. end
  1934. signal casht3
  1935. casht4:
  1936. signal team2
  1937.  
  1938. seart:
  1939. transmit '\n1\c6[\c1Search For Other Team Members\c6]\n1'
  1940. transmit '\c2Searching\c1...\c3'
  1941. x=0
  1942. seart2:
  1943. x=x+1
  1944. if x>40 then signal seart3
  1945. if x=ur then signal seart2
  1946. if pl.x.2=0 then signal seart2
  1947. if pl.x.2=pl.ur.2 then do
  1948. sendstring '\n1Name    : 'pl.x.1
  1949. if pl.x.4 = 0 then do
  1950. transmit ' \c2(Dead)'
  1951. signal seart2
  1952. end
  1953. transmit '\n1\c2Sector  : 'pl.x.4
  1954. transmit 'Fighters: 'pl.x.3
  1955. transmit 'TCredits: 'pl.x.12
  1956. transmit ''
  1957. end
  1958. signal seart2
  1959. seart3:
  1960. transmit '\n1\c2Search Complete.'
  1961. signal team2
  1962.  
  1963. trant:
  1964. transmit '\n1\c6[\c1List Teams And Members\c6]\n1'
  1965. x=0
  1966. trant2:
  1967. x=x+1
  1968. if x>10 then signal trant4
  1969. if left(tn.x,2) ~= '..' then do
  1970. transmit '\n1\c3Team' x ' '
  1971. transmit 'Name   : 'tn.x
  1972. transmit 'Leader : 'tle.x
  1973. transmit 'Members: '
  1974. do y=1 to 40
  1975. if pl.y.2=x then do
  1976. if pl.y.1 ~= tle.x then transmit '         'pl.y.1
  1977. end
  1978. end
  1979. end
  1980. signal trant2
  1981. trant4:
  1982. transmit '\n1\c2List Complete.'
  1983. signal team2
  1984.  
  1985. chant:
  1986. transmit '\n1\c6[\c1Change Team 'tt.1'\c6]\n1'
  1987. teamnumber=pl.ur.2
  1988. tt.2=tpd.teamnumber
  1989. if y=1 then tt.2=tn.teamnumber
  1990. if pl.ur.1 ~= tle.teamnumber then do
  1991. transmit '\c2You are not the captain of the team!'
  1992. signal team2
  1993. end
  1994. transmit '\c3The current 'tt.1' is 'tt.2
  1995. sendstring 'The new 'tt.1' is: '
  1996. query
  1997. an=result
  1998. if y=0 then upper an
  1999. if an='' then signal team2
  2000. if an='###PANIC' then signal end2
  2001. if y=0 then tpd.teamnumber=an
  2002. if y=1 then tn.teamnumber=an
  2003. call saveteam
  2004. transmit '\n1'tt.1' Changed.'
  2005. signal team2
  2006.  
  2007. saveteam:
  2008. fle=PFT't 'teamnumber
  2009. call open file, (fle), 'W'
  2010. call writeln file, tn.teamnumber
  2011. call writeln file, tle.teamnumber
  2012. call writeln file, tpd.teamnumber
  2013. call close file
  2014. return
  2015.  
  2016. kick:
  2017. transmit '\n1\c6[\c1Remove Team Member\c6]\n1\c1'
  2018. teamnumber=pl.ur.2
  2019. if pl.ur.1 ~= tle.teamnumber then do
  2020.   transmit '\c2You are not the captain of the team!' 
  2021.   signal team2
  2022. end
  2023. x=0
  2024. kick2:
  2025. x=x+1
  2026. if x>40 then signal kick3
  2027. if x=ur then signal kick2
  2028. if pl.x.2=pl.ur.2 then do
  2029. transmit 'Player #'||x||'  Name: '||trim(pl.x.1)
  2030. end
  2031. signal kick2
  2032. kick3:
  2033. aks='\n1Remove which member? '
  2034. call askq
  2035. if an='' then signal team2
  2036. if pl.an.2 ~= pl.ur.2 then do
  2037. transmit '\n1He is not a member of your team!'
  2038. signal team2
  2039. end
  2040. pl.an.2=0
  2041. x=an
  2042. call saveuser
  2043. hap='You were removed from team 'teamnumber
  2044. call hapopen
  2045. transmit '\c1'||pl.x.1||' removed from your team.'
  2046. transmit 'You should now change your team password if you haven''t already.'
  2047. signal team2
  2048.  
  2049. createp:
  2050. transmit '\n1\c4There is no planet in this sector.'
  2051. sendstring '\c5Do you wish to create one for 10,000 credits (y/N)? '
  2052. call ask
  2053. if an='Y' then signal createp2
  2054. signal mainmenu
  2055.  
  2056. createp2:
  2057. if pl.ur.12<10000 then do
  2058. transmit '\n1\c1You do not have enough trading credits!'
  2059. signal mainmenu
  2060. end
  2061. aks='\n1\c3Please enter a name for your planet: '
  2062. call askq
  2063. if an='' then signal mainmenu
  2064. if left(an,2)='..' then signal mainmenu
  2065. sd.26=an
  2066. pw=''
  2067. pl.ur.12=pl.ur.12-10000
  2068. call ws
  2069. transmit '\n1\c6Creating planet...'
  2070. fle=PFW||sector||'.tw'
  2071. call open file, (fle), 'W'
  2072. temp=trim(pl.ur.1)
  2073. call writeln file, temp
  2074. call writeln file, '1'
  2075. call writeln file, '1'
  2076. call writeln file, '1'
  2077. call writeln file, '1'
  2078. call writeln file, '1'
  2079. call writeln file, '1'
  2080. call writeln file, date('C')
  2081. call writeln file, '0'
  2082. call writeln file, '0'
  2083. call writeln file, pw
  2084. call writeln file, '10'
  2085. call writeln file, '20'
  2086. call writeln file, '30'
  2087. call close file
  2088. transmit '\n1TerraForming Completed.'
  2089. transmit '\c1Who do you think you are?  God, perhaps?'
  2090. a=trim(pl.ur.1)||' created a planet somewhere...'
  2091. call newspaperopen
  2092. signal mainmenu
  2093.  
  2094. land:
  2095. transmit '\n1\c6[\c1Land On Planet\c6]\c3\n1'
  2096. if left(sd.26,2)='..' then signal createp
  2097. if sd.26='' then signal createp
  2098. fle=PFW||sector||'.tw'
  2099. call open file, (fle), 'R'
  2100. do x=1 to 14
  2101. pd.x=readln(file)
  2102. end
  2103. call close file
  2104. transmit '*Deducting One Turn For Landing*'
  2105. turns=turns-1
  2106. call updatep
  2107. call planetreport
  2108. signal planetmain
  2109.  
  2110. plansave:
  2111. fle=PFW||sector||'.tw'
  2112. call open file, (fle), 'W'
  2113. do x=1 to 14
  2114. call writeln file, pd.x
  2115. end
  2116. call close file
  2117. return
  2118.  
  2119. updatep:
  2120. if pd.8=date('c') then return
  2121. an=date('c')-pd.8
  2122. if an=0 then return
  2123. transmit '\c4Last landing was \c1'an'\c4 days ago.' 
  2124. temp=pd.2*an
  2125. pd.3=pd.3+temp
  2126. temp=pd.4*an
  2127. pd.5=pd.5+temp
  2128. temp=pd.6*an
  2129. pd.7=pd.7+temp
  2130. pd.8=date('c')
  2131. return
  2132.  
  2133. planetreport:
  2134. transmit '\n1\c6Planet: \c1'sd.26
  2135. transmit '\n1Commodity  Prod.  Amount  In Holds'
  2136. transmit '=================================='
  2137. tt.1=center(pd.2,5,' ');tt.2=center(pd.3,6,' ');tt.3=center(pl.ur.9,8,' ')
  2138. transmit 'Organics   'tt.1'  'tt.2'  'tt.3
  2139. tt.1=center(pd.4,5,' ');tt.2=center(pd.5,6,' ');tt.3=center(pl.ur.8,8,' ')
  2140. transmit 'Ore        'tt.1'  'tt.2'  'tt.3
  2141. tt.1=center(pd.6,5,' ');tt.2=center(pd.7,6,' ');tt.3=center(pl.ur.10,8,' ')
  2142. transmit 'Equipment  'tt.1'  'tt.2'  'tt.3
  2143. an=pl.ur.7-pl.ur.8-pl.ur.9-pl.ur.10
  2144. transmit '\n1\c4You have \c1'an'\c4 free cargo holds.'
  2145. return
  2146.  
  2147. planetmain:
  2148. sendstring '\n1\c6'sd.26': '
  2149. call ask
  2150. if an='' then signal planetmain
  2151. if an='###PANIC' then signal end2
  2152. if an='1' then do;number=3;call takecom;signal planetmain;end
  2153. if an='2' then do;number=5;call takecom;signal planetmain;end
  2154. if an='3' then do;number=7;call takecom;signal planetmain;end
  2155. if an='A' then signal takeall
  2156. if an='L' then signal leave
  2157. if an='D' then signal destroy
  2158. if an='I' then signal increase
  2159. if an='R' then do;call planetreport;signal planetmain;end
  2160. if an='?' then do
  2161. sendfile PF'planet.help'
  2162. end
  2163. signal planetmain
  2164.  
  2165. takecom:
  2166. y=pl.ur.7-pl.ur.8-pl.ur.9-pl.ur.10
  2167. if y=0 then do
  2168. transmit '\c1You have no free holds!'
  2169. z=1
  2170. return
  2171. end
  2172. if number=3 then do;x=9;tt.1='Organics';end
  2173. if number=5 then do;x=8;tt.1='Ore';end
  2174. if number=7 then do;x=10;tt.1='Equipment';end
  2175. transmit '\n1\c5You have 'y' free holds.'
  2176. if pd.number=0 then do
  2177. transmit '\c1No units available!'
  2178. return
  2179. end
  2180. if pd.number<y then do
  2181. pl.ur.x=pl.ur.x+pd.number
  2182. transmit '\c1You collected 'pd.number' units of 'tt.1'.'
  2183. pd.number=0
  2184. return
  2185. end
  2186. if pd.number=y | pd.number>y then do
  2187. pl.ur.x=pl.ur.x+y
  2188. pd.number=pd.number-y
  2189. transmit '\c1You collected 'y' units of 'tt.1'.'
  2190. return
  2191. end
  2192. return
  2193.  
  2194. takeall:
  2195. number=3
  2196. call takecom
  2197. if z=1 then signal planetmain
  2198. number=5
  2199. call takecom
  2200. if z=1 then signal planetmain
  2201. number=7
  2202. call takecom
  2203. signal planetmain
  2204.  
  2205. leave:
  2206. call plansave
  2207. drop tt pd
  2208. signal mainmenu
  2209.  
  2210. increase:
  2211. transmit '\n1\c2Increase Which One?'
  2212. transmit '\c6[\c11\c6] \c3 Organics'
  2213. transmit '\c6[\c12\c6] \c3 Ore'
  2214. transmit '\c6[\c13\c6] \c3 Equipment'
  2215. bufferflush
  2216. aks='\n1\c4: '
  2217. call askq
  2218. if an='' then signal planetmain
  2219. number=0
  2220. if an=1 then do;number=2;x=200;tt.1='Organics';end
  2221. if an=2 then do;number=4;x=400;tt.1='Ore';end
  2222. if an=3 then do;number=6;x=700;tt.1='Equipment';end
  2223. if number=0 then signal planetmain
  2224. if pd.number=20 then do
  2225. transmit '\c1Production is limited to 20 units per day!'
  2226. signal planetmain
  2227. end
  2228. sendstring '\c6It will cost \c1'||x||'\c6 credits per unit to increase'
  2229. transmit ' \c1'tt.1'\c6 production.'
  2230. transmit 'You have \c1'pl.ur.12'\c6 trading credits.'
  2231. z=20-pd.number
  2232. aks='Increase by how many units (\c1'z'\c6 = max)? '
  2233. call askq
  2234. if an='' then signal planetmain
  2235. if an<1 | an>z then signal increase
  2236. if an*x>pl.ur.12 then do
  2237. transmit '\c1You do not have enough trading credits!'
  2238. signal increase
  2239. end
  2240. temp=an*x
  2241. pl.ur.12=pl.ur.12-temp
  2242. pd.number=pd.number+an
  2243. transmit tt.1' production is now at '||pd.number||' units per day.'
  2244. signal planetmain
  2245.  
  2246. destroy:
  2247. bufferflush
  2248. sendstring '\n1\c2Do you really want to destroy this lovely planet? '
  2249. call ask
  2250. if an='Y' then signal destroy2
  2251. signal planetmain
  2252.  
  2253. destroy2:
  2254. transmit '\c2Planetary defense attacks...'
  2255. x=random(1,50,time('s'))
  2256. if x>pl.ur.3 then x=pl.ur.3
  2257. if x=pl.ur.3 then do
  2258. transmit '\n1They were too strong for you!'
  2259. signal dead
  2260. end
  2261. transmit '\c6You lost \c1'||x||'\c6 fighters.'
  2262. pl.ur.3=pl.ur.3-x
  2263. transmit 
  2264. transmit '\c6You destroyed \c1'sd.26'\c6.  Are you happy?'
  2265. a=pl.ur.1' destroyed a planet named 'sd.26
  2266. call newspaperopen
  2267. sd.26 = '....................'
  2268. call ws
  2269. if exists(PFW||sector||'.tw') then do
  2270. address command 'delete 'PFW||sector||'.tw'
  2271. end
  2272. signal mainmenu
  2273.  
  2274. ask:
  2275. bufferflush
  2276. getchar
  2277. an=upper(result)
  2278. if an='###PANIC' then signal end2
  2279. transmit an
  2280. return
  2281.  
  2282. askq:
  2283. bufferflush
  2284. query aks
  2285. an=result
  2286. an=strip(an)
  2287. if an='###PANIC' then signal end2
  2288. return
  2289.  
  2290. ldftr:
  2291. if ~exists(PFU'fighters') then do
  2292. y=0
  2293. return
  2294. end
  2295. call open file, (PFU'fighters'), 'R'
  2296. y=0
  2297. do until eof(file)
  2298. y=y+1
  2299. pd.y=readln(file)
  2300. end
  2301. call close file
  2302. return
  2303.